from app import db

#用户
class User_table(db.Model):
    __tablename__ = 'User_table'
    id = db.Column(db.Integer,primary_key = True)
    username = db.Column(db.String(32),nullable = False,unique = True)
    password = db.Column(db.String(36),nullable = False)
    token = db.Column(db.String(36),nullable = True)

#首页 大图
class Index_table(db.Model):
    __tablename__ = 'Index_table'
    id = db.Column(db.Integer,primary_key = True)
    img_file = db.Column(db.Text(),nullable=False)
    img_url = db.Column(db.Text(),nullable=True)


#首页 视频
class Index_video(db.Model):
    __tablename__ = 'Index_video'
    id = db.Column(db.Integer,primary_key = True)
    video_tle = db.Column(db.String(32),nullable = True)
    video_tleen = db.Column(db.Text(),nullable = True)
    video_img = db.Column(db.Text(),nullable = True)
    video_file = db.Column(db.Text(),nullable = True)

#首页图文介绍
class Index_txt(db.Model):
    __tablename__ = 'Index_txt'
    id = db.Column(db.Integer,primary_key = True)
    content = db.Column(db.Text(),nullable = False)

#品牌介绍
class Brands_table(db.Model):
    __tablename__ = 'Brands_table'
    id = db.Column(db.Integer,primary_key = True)
    head_tle = db.Column(db.Text(),nullable = True)
    big_img = db.Column(db.Text(),nullable = True)
    img_txt = db.Column(db.Text(),nullable = True)
    md_tle = db.Column(db.Text(),nullable = True)
    bot_tle = db.Column(db.Text(),nullable = True)

#品牌介绍--错位图上传
class Brands_img(db.Model):
    __tablename__ = 'Brands_img'
    id = db.Column(db.Integer,primary_key = True)
    urls = db.Column(db.Text(),nullable = True)
    index = db.Column(db.Integer,unique = False)

#店铺信息
class Shop_information(db.Model):
    __tablename__ = 'Shop_information'
    id = db.Column(db.Integer,primary_key = True)
    img_url = db.Column(db.Text(),nullable = True)
    title = db.Column(db.Text(),nullable = True)
    content = db.Column(db.Text(),nullable = True)
    
#社交媒体
class Admin_media(db.Model):
    __tablename__ = 'Admin_media'
    id = db.Column(db.Integer,primary_key = True)
    content = db.Column(db.Text(),nullable = True)

#会员中心
class Vip_center(db.Model):
    __tablename__ = 'Vip_center'
    id = db.Column(db.Integer,primary_key = True)
    content = db.Column(db.Text(),nullable = True)

#联系我们 背景图
class Contact_us(db.Model):
    __tablename__ = 'Contact_us'
    id = db.Column(db.Integer,primary_key = True)
    content = db.Column(db.Text(),nullable = True)

#联系我们 联系方式
class Contact_way(db.Model):
    __tablename__ = 'Contact_way'
    id = db.Column(db.Integer,primary_key = True)
    icon = db.Column(db.Text(),nullable = True)
    tle = db.Column(db.Text(),nullable = True)
    cont = db.Column(db.Text(),nullable = True)

#产品 分类列表
class Product_class(db.Model):
    __tablename__ = 'Product_class'
    id = db.Column(db.Integer,primary_key = True)
    name = db.Column(db.String(32),nullable = False)
    parent_menu = db.Column(db.Integer,nullable = True)
    products = db.relationship('Product_list', backref='product_class')

#产品 产品列表
class Product_list(db.Model):
    __tablename__ = 'Product_list'
    id = db.Column(db.Integer,primary_key = True)
    name = db.Column(db.Text(),nullable = False)
    img_url = db.Column(db.Text(),nullable = False)
    price = db.Column(db.Float(),nullable = True)
    goods_link = db.Column(db.Text(),nullable = True)
    class_id = db.Column(db.Integer, db.ForeignKey('Product_class.id'))
    skus = db.relationship('Product_sku',backref='products')

#产品 产品sku
class Product_sku(db.Model):
    __tablename__ = 'Product_sku'
    id = db.Column(db.Integer,primary_key = True)
    img_url = db.Column(db.Text(),nullable = False)
    product_id = db.Column(db.Integer, db.ForeignKey('Product_list.id'))

#LOOKBOOK
class Admin_lookbook(db.Model):
    __tablename__ = 'Admin_lookbook'
    id = db.Column(db.Integer,primary_key = True)
    content = db.Column(db.Text(),nullable = False)
